package com.ssc.manager.common.init;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ssc.manager.admin.ice.IceServerUtil;
import com.ssc.manager.admin.ice.TransferInterface;
import com.ssc.manager.admin.service.IConfigDataService;
import com.ssc.manager.admin.service.IPlayDataService;
import com.ssc.manager.common.utils.AppConfig;

@Component
public class SystemInit {
	public static final String SERVERPATH = "com/ssc/manager/admin/ice/config.server";
	
	@Autowired
	private IConfigDataService configDataService;
	
	@Autowired
	private TransferInterface transferInterface;
	
	@Autowired
	private IPlayDataService playDataService;
	
	
	@PostConstruct
	public void init() {	
		initDatas();
		initIceServer();
	}
	
	private void initIceServer(){
		// 启动ICE服务
		Map<String, Ice.Object> srvObjMap = new HashMap<String, Ice.Object>();
		srvObjMap.put(AppConfig.getProperty("serverIce.objKey"), transferInterface);
		IceServerUtil.startIceServer(srvObjMap, SERVERPATH);
	}
	
	
	/*private void initBetQueue(){
		BettingQueue bettingQueue = new  BettingQueue();
		bettingQueue.setBettingService(bettingService);
		bettingQueue.start();
		SystemData.setBetQueue(bettingQueue);
	}*/
	private void initDatas() {
		configDataService.initData();
		playDataService.initPlayData();
	}
}
